<template>
	<Card style="height:900px">
    <Form ref="loanInfoForm" :model="loanInfoForm"  :label-width="120" inline>
        <Row>
            <h3>贷款信息：</h3>
        </Row>
        <br>
        <FormItem label="申请金额" prop="principalAmt">
            <Input v-model="loanInfoForm.principalAmt" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="申请期数" prop="applyTerms">
            <Input v-model="loanInfoForm.applyTerms" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="申请产品" prop="productTypeName">
            <Input v-model="loanInfoForm.productTypeName" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="产品代码" prop="productCode">
            <Input v-model="loanInfoForm.productCode" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="借款用途" prop="purposeCode" >
            <Select v-model="loanInfoForm.purposeCode" class="task-process-detail-select" disabled>
                <Option v-for="item in selectPurposeData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <Row>
            <h3>账户信息：</h3>
            <div style="float:right;">
                <!-- <Button type="primary">刷新</Button> -->
                <Button type="primary" @click="submitForm">保存</Button>
            </div>
        </Row>
        <br>
        <FormItem label="收款账户银行" prop="receiveBankName">
            <Input v-model="loanInfoForm.receiveBankName" placeholder="" >
            </Input>
        </FormItem>
        <FormItem label="收款账户名称" prop="receiveAcctName">
            <Input v-model="loanInfoForm.receiveAcctName" placeholder=""  disabled>
            </Input>
        </FormItem>
        <FormItem label="收款账户卡号" prop="receiveAcctNo">
            <Input v-model="loanInfoForm.receiveAcctNo" placeholder=""  disabled>
            </Input>
        </FormItem>
        <FormItem label="还款账户银行" prop="paymentBankName">
            <Input v-model="loanInfoForm.paymentBankName" placeholder="" >
            </Input>
        </FormItem>
        <FormItem label="还款账户名称" prop="paymentAcctName">
            <Input v-model="loanInfoForm.paymentAcctName" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="还款账户卡号" prop="paymentAcctNo">
            <Input v-model="loanInfoForm.paymentAcctNo" placeholder="" disabled>
            </Input>
        </FormItem>
        <Row>
            <h3>保单信息：</h3>
        </Row>
        <br>
        <Row>
            <Table :columns="columns2" :data="recordingData"></Table>
        </Row>
        <br>
        <FormItem label="保险公司" prop="insurancePolicy.insuranceCpyCode">
            <Select v-model="loanInfoForm.insurancePolicy.insuranceCpyCode" class="task-process-detail-select" disabled>
                <Option v-for="item in selectInsuranceCpyData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <FormItem label="保单号" prop="insurancePolicy.insuranceNum">
            <Input v-model="loanInfoForm.insurancePolicy.insuranceNum" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="主险名称" prop="insurancePolicy.insuranceName">
            <Input v-model="loanInfoForm.insurancePolicy.insuranceName" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="保单类型" prop="insurancePolicy.insuranceTypeCode">
            <Select v-model="loanInfoForm.insurancePolicy.insuranceTypeCode" class="task-process-detail-select" disabled>
                <Option v-for="item in selectInsuranceTypeData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <FormItem label="寿险类型" prop="insurancePolicy.lifeInsuranceTypeCode">
            <Select v-model="loanInfoForm.insurancePolicy.lifeInsuranceTypeCode" class="task-process-detail-select" disabled>
                <Option v-for="item in selectLifeInsuranceTypeData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <FormItem label="保单生效日" prop="insurancePolicy.insuranceEftDate">
            <DatePicker disabled v-model="loanInfoForm.insurancePolicy.insuranceEftDate" :value="loanInfoForm.insurancePolicy.insuranceEftDate" type="date" placeholder=""></DatePicker>
        </FormItem>
        <FormItem label="保费总额" prop="insurancePolicy.insuranceAmount">
            <Input v-model="loanInfoForm.insurancePolicy.insuranceAmount" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="保单状态" prop="insurancePolicy.insuranceStatus">
            <Select v-model="loanInfoForm.insurancePolicy.insuranceStatus" class="task-process-detail-select" disabled>
                <Option v-for="item in selectInsuranceStatusData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <FormItem label="投保年限" prop="insurancePolicy.insuranceYears">
            <Input v-model="loanInfoForm.insurancePolicy.insuranceYears" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="附加险数量" prop="insurancePolicy.additionalInsuranceNum">
            <Input v-model="loanInfoForm.insurancePolicy.additionalInsuranceNum" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="缴费方式" prop="insurancePolicy.nsurancePayTypeCode">
            <Select v-model="loanInfoForm.insurancePolicy.insurancePayTypeCode" class="task-process-detail-select" disabled>
                <Option v-for="item in selectInsurancePayTypeData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <FormItem label="年缴保费" prop="insurancePolicy.insuranceYearAmount">
            <Input v-model="loanInfoForm.insurancePolicy.insuranceYearAmount" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="应缴期数" prop="insurancePolicy.insuranceTotalTerms">
            <Input v-model="loanInfoForm.insurancePolicy.insuranceTotalTerms" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="已缴期数" prop="insurancePolicy.insurancePayedTerms">
            <Input v-model="loanInfoForm.insurancePolicy.insurancePayedTerms" placeholder="" disabled>
            </Input>
        </FormItem>
        <FormItem label="投保人是否有变更" prop="insurancePolicy.policyholderChanged">
            <Select v-model="loanInfoForm.insurancePolicy.policyholderChanged" class="task-process-detail-select" disabled>
                <Option v-for="item in selectPolicyholderChangedData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <FormItem label="保单是否存在保单贷款" prop="insurancePolicy.insuranceExistLoan">
            <Select v-model="loanInfoForm.insurancePolicy.insuranceExistLoan" class="task-process-detail-select" disabled>
                <Option v-for="item in selectInsuranceExistLoanData" :value="item.code" :key="item.code">{{ item.name }}</Option>
            </Select>
        </FormItem>
        <Row>
            <h3>房产信息：</h3>
        </Row>
        <br>
        <Row>
            <Button type="primary" icon="android-add" style="width:60px;" @click="addEstateDefaultEmptyRow" disabled></Button>
            <Table :columns="columns3" :data="estateData" ></Table>
        </Row>
        <br>
        <Row>
            <h3>保单核录信息：</h3>
        </Row>
        <br>
        <Row type="flex" justify="center" align="middle">
            <Col span="4"><h4>核验项</h4></Col>
            <Col span="4"><h4>核验结果</h4></Col>
            <Col span="4"><h4>备注</h4></Col>
            <Col span="4"><h4>核验项</h4></Col>
            <Col span="4"><h4>核验结果</h4></Col>
            <Col span="4"><h4>备注</h4></Col>
        </Row>
        <Row type="flex" justify="center" align="middle">
            <Col span="4">
                <span>保单截屏是否齐全</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.screenCaptureCheck">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.screenCaptureCheck" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.screenCaptureRemark">
                    <Input v-model="loanInfoForm.insuranceCheck.screenCaptureRemark" disabled></Input>
                </FormItem>
            </Col>
            <Col span="4">
                <span>电核保单是否正常</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.phoneCheckResult">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.phoneCheckResult" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.phoneCheckRemark">
                    <Input v-model="loanInfoForm.insuranceCheck.phoneCheckRemark" disabled></Input>
                </FormItem>
            </Col>
        </Row>
        <Row type="flex" justify="center" align="middle">
            <Col span="4">
                <span>保单是否垫缴</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.policyDisbursementsStatus">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.policyDisbursementsStatus" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
            <Col span="4">
                <span>最近三年是否有断缴、复效</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.recently3YOffpayStatus">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.recently3YOffpayStatus" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
        </Row>
        <Row type="flex" justify="center" align="middle">
            <Col span="4">
                <span>最近一次缴费的时间</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.lastPayDate">
                    <DatePicker v-model="loanInfoForm.insuranceCheck.lastPayDate" :value="loanInfoForm.insuranceCheck.lastPayDate" type="date" disabled></DatePicker>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
            <Col span="4">
                <span>最近一次缴费的金额</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.lastPayAmount">
                    <Input v-model="loanInfoForm.insuranceCheck.lastPayAmount" disabled></Input>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
        </Row>
        <Row type="flex" justify="center" align="middle">
            <Col span="4">
                <span>最近一年是否有更换缴费方式</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.recentlyYChangePayType">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.recentlyYChangePayType" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
            <Col span="4">
                <span>录音是否完整</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.recordFullStatus">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.recordFullStatus" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.recordFullRemark">
                    <Input v-model="loanInfoForm.insuranceCheck.recordFullRemark" disabled></Input>
                </FormItem>
            </Col>
        </Row>
        <Row type="flex" justify="center" align="middle">
            <Col span="4">
                <span>是否按政策要求提问</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.quizStatus">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.quizStatus" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
            <Col span="4">
                <span>是否为借款人本人的保单</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.selfPolicy">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.selfPolicy" >
                        <Radio v-for="item in selectRadioGroup1" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
        </Row>
        <Row type="flex" justify="center" align="middle">
            <Col span="4">
                <span>是否有其他问题</span>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.otherQuestion">
                    <RadioGroup v-model="loanInfoForm.insuranceCheck.otherQuestion" >
                        <Radio v-for="item in selectRadioGroup2" :key="item.code" :label="item.code" disabled>{{ item.name }}</Radio>
                    </RadioGroup>
                </FormItem>
            </Col>
            <Col span="4">
                <FormItem prop="insuranceCheck.otherQuestionRemark">
                    <Input v-model="loanInfoForm.insuranceCheck.otherQuestionRemark" disabled></Input>
                </FormItem>
            </Col>
            <Col span="4">

            </Col>
            <Col span="4">

            </Col>
            <Col span="4">

            </Col>
        </Row>
        <!-- <Row>
            <div align="center">
                <Button type="primary" @click="submitForm">保存</Button>
            </div>
        </Row> -->
    </Form>
    </Card>
</template>

<script>
export default {
  name: 'loan-info-form',
  data () {
    return {
      baseUrl: this.$appContext.marvels_core_approve,
      $ajax: null,
      curLoanId: this.$route.query.loanId,
      loanInfoForm: {// 贷款信息
        principalAmt: null,
        applyTerms: null,
        productTypeName: null,
        productCode: null,
        purposeCode: null,
        receiveBankName: null,
        receiveAcctName: null,
        receiveAcctNo: null,
        paymentBankName: null,
        paymentAcctName: null,
        paymentAcctNo: null,
        insurancePolicy: {// 保单信息
          insuranceCpyCode: null,
          insuranceNum: null,
          insuranceName: null,
          insuranceTypeCode: null,
          lifeInsuranceTypeCode: null,
          insuranceEftDate: null,
          insuranceAmount: null,
          insuranceStatus: null,
          insuranceYears: null,
          additionalInsuranceNum: null,
          insurancePayTypeCode: null,
          insuranceYearAmount: null,
          insuranceTotalTerms: null,
          insurancePayedTerms: null,
          policyholderChanged: 0,
          insuranceExistLoan: 0
        },
        insuranceCheck: {// 保单核录信息
          screenCaptureCheck: null,
          screenCaptureRemark: null,
          phoneCheckResult: null,
          phoneCheckRemark: null,
          policyDisbursementsStatus: null,
          recently3YOffpayStatus: null,
          lastPayDate: null,
          lastPayAmount: null,
          recentlyYChangePayType: null,
          recordFullStatus: null,
          recordFullRemark: null,
          quizStatus: null,
          selfPolicy: null,
          otherQuestion: null,
          otherQuestionRemark: null
        }

      },
      selectPurposeData: [],
      columns2: [
        {
          title: '序号',
          type: 'index',
          align: 'center',
          width: 120
        },
        {
          align: 'center',
          title: '文件地址',
          key: 'fileName',
          render: function (h, params) {
            return h('a', {
              attrs: {
                href: params.row.fileLocation
              }
            }, params.row.fileName)
          }
        },
        {
          align: 'center',
          title: '文件识别结果',
          key: 'content'
        }
      ],
      recordingData: [],
      selectInsuranceCpyData: [],
      selectInsuranceTypeData: [],
      selectLifeInsuranceTypeData: [],
      selectInsuranceStatusData: [],
      selectInsurancePayTypeData: [],
      selectPolicyholderChangedData: [
        {
          code: 0,
          name: '否'
        },
        {
          code: 1,
          name: '是'
        }
      ],
      selectInsuranceExistLoanData: [
        {
          code: 0,
          name: '否'
        },
        {
          code: 1,
          name: '是'
        }
      ],
      columns3: [
        {
          align: 'center',
          title: '房产名称',
          key: 'estateName',
          render: function (h, params) {
            const vm = this
            return h('Input', {
              props: {
                type: 'text',
                value: params.row.estateName,
                disabled: true
              },
              on: {
                'on-change' (e) {
                  vm.initTempEstateDataObject(params)
                  vm.$set(vm.tempEstateData[params.index], 'estateName', e.target.value)
                }
              }
            })
          }.bind(this)
        },
        {
          align: 'center',
          title: '房产地址',
          key: 'estateAddress',
          render: function (h, params) {
            const vm = this
            return h('Input', {
              props: {
                type: 'text',
                value: params.row.estateAddress,
                disabled: true
              },
              on: {
                'on-change' (e) {
                  vm.initTempEstateDataObject(params)
                  vm.$set(vm.tempEstateData[params.index], 'estateAddress', e.target.value)
                }
              }
            })
          }.bind(this)
        },
        {
          align: 'center',
          title: '开始时间',
          key: 'estateLoanStartDate',
          render: function (h, params) {
            const vm = this
            return h('DatePicker', {
              props: {
                type: 'date',
                value: params.row.estateLoanStartDate,
                disabled: true
              },
              on: {
                'on-change' (v1, v2) {
                  // vm.estateData[params.index].estateLoanStartDate = v1;
                  vm.initTempEstateDataObject(params)
                  vm.$set(vm.tempEstateData[params.index], 'estateLoanStartDate', v1)
                }
              }
            })
          }.bind(this)
        },
        {
          align: 'center',
          title: '还款期数',
          key: 'estateLoanPaidTerms',
          render: function (h, params) {
            const vm = this
            return h('Input', {
              props: {
                type: 'text',
                value: params.row.estateLoanPaidTerms,
                disabled: true
              },
              on: {
                'on-change' (e) {
                  vm.initTempEstateDataObject(params)
                  vm.$set(vm.tempEstateData[params.index], 'estateLoanPaidTerms', e.target.value)
                }
              }
            })
          }.bind(this)
        },
        {
          align: 'center',
          title: '月还款额',
          key: 'estateLoanMthPayment',
          render: function (h, params) {
            const vm = this
            return h('Input', {
              props: {
                type: 'text',
                value: params.row.estateLoanMthPayment,
                disabled: true
              },
              on: {
                'on-change' (e) {
                  vm.initTempEstateDataObject(params)
                  vm.$set(vm.tempEstateData[params.index], 'estateLoanMthPayment', e.target.value)
                }
              }
            })
          }.bind(this)
        },
        {
          align: 'center',
          title: '贷款状态',
          key: 'estateLoanStatus',
          render: function (h, params) {
            const vm = this
            return h('Select', {
              props: {
                value: params.row.estateLoanStatus,
                disabled: true
              },
              on: {
                'on-change' (value) {
                  vm.initTempEstateDataObject(params)
                  vm.$set(vm.tempEstateData[params.index], 'estateLoanStatus', value)
                }
              }
            }, this.selectEstateLoanStatusData.map(function (item) {
              return h('Option', {
                props: {
                  value: item.code,
                  disabled: true
                }
              }, item.name)
            })
            )
          }.bind(this)
        },
        {
          align: 'center',
          title: '操作',
          width: 80,
          key: 'action',
          render: (h, params) => {
            var vm = this
            return h('div', [
              h('Button', {
                props: {
                  type: 'error',
                  size: 'small',
                  disabled: true
                },
                on: {
                  click: () => {
                    // vm.tempEstateData.splice(params.index,1);
                    // vm.estateData = vm.cloneObject(vm.tempEstateData);
                    vm.delEstateRowData(params)
                  }
                }
              }, ' 删除')
            ])
          }
        }
      ],
      estateData: [ // 房产信息 表格数据
        // {
        //     estateName:'test',
        //     estateAddress:null,
        //     estateLoanStartDate:'20180501',
        //     estateLoanStatus:'0',
        //     estateLoanPaidTerms:null,
        //     estateLoanMthPayment:null
        // }
      ],
      tempEstateData: [], // 房产信息 临时表格数据
      estateEmptyRowData: { // 房产信息表格空行对象
        estateName: null,
        estateAddress: null,
        estateLoanStartDate: null,
        estateLoanStatus: null,
        estateLoanPaidTerms: null,
        estateLoanMthPayment: null
      },
      selectEstateLoanStatusData: [
        {
          code: '0',
          name: '未结清'
        },
        {
          code: '1',
          name: '已结清'
        }
      ],
      selectRadioGroup1: [
        {
          code: '0',
          name: '否'
        },
        {
          code: '1',
          name: '是'
        }
      ],
      selectRadioGroup2: [
        {
          code: '0',
          name: '无'
        },
        {
          code: '1',
          name: '有'
        }
      ]
    }
  },
  methods: {
    initpage: function () {
      // 初始化下拉列表数据
      this.initSelectData()
    },
    // 初始化下拉列表数据
    initSelectData () {
      var vm = this
      this.$ajax.post(this.baseUrl + 'approve/process/task_process/service/getBasicDatas').then(re => {
        var data = re.data
        var code = data.code
        var message = data.message
        if (code !== 'success') {
          this.$Message.warning(message)
          return
        }
        vm.selectPurposeData = data.data.purposeBasicData
        vm.selectInsuranceCpyData = data.data.insuranceCompanyBasicData
        vm.selectInsuranceTypeData = data.data.insuranceTypeBasicData
        vm.selectLifeInsuranceTypeData = data.data.lifeInsuranceTypeBasicData
        vm.selectInsuranceStatusData = data.data.insuranceStatusBasicData
        vm.selectInsurancePayTypeData = data.data.paymentModeBasicData
        // 初始化贷款信息tab
        vm.initLoanInfo()
      }).catch(er => {

      })
    },
    // 初始化贷款信息tab
    initLoanInfo () {
      var vm = this
      var url = this.baseUrl + 'approve/process/task_process/service/getLoanDetail/' + this.curLoanId
      this.$ajax.get(url).then(re => {
        var data = re.data
        var code = data.code
        var message = data.message
        if (code !== 'success') {
          this.$Message.warning(message)
          return
        }
        vm.loanInfoForm = data.data
        if (!vm.loanInfoForm.insurancePolicy) {
          vm.loanInfoForm.insurancePolicy = {}
        }

        if (!vm.loanInfoForm.insuranceCheck) {
          vm.loanInfoForm.insuranceCheck = {}
        }
        vm.loanInfoForm.insurancePolicy.insuranceEftDate = new Date(vm.loanInfoForm.insurancePolicy.insuranceEftDate)
        vm.loanInfoForm.insuranceCheck.lastPayDate = new Date(vm.loanInfoForm.insuranceCheck.lastPayDate)
        // 初始化房产信息
        vm.initEstateTable()
        // 初始化录音文件列表
        if (data.data.attachmentList) {
          vm.recordingData = data.data.attachmentList
        }
      }).catch(er => {

      })
    },
    // 初始化房产信息
    initEstateTable () {
      if (this.loanInfoForm.estateList && this.loanInfoForm.estateList.length > 0) {
        this.loadEstateData()
      }
    },
    // 加载房产信息
    loadEstateData () {
      this.estateData = this.loanInfoForm.estateList
      for (var i in this.estateData) {
        this.estateData[i].estateLoanStartDate = this.$util.formatDate(this.estateData[i].estateLoanStartDate)
      }
      // 初始化临时房产数组数据
      if (this.estateData && this.estateData.length > 0) {
        this.tempEstateData = this.cloneObject(this.estateData)
      }
    },
    // 保存贷款信息
    submitForm () {
      var vm = this
      this.$refs.loanInfoForm.validate(valid => {
        if (valid) {
          this.loanInfoForm.loanId = this.curLoanId
          this.estateData = this.cloneObject(this.tempEstateData)
          this.loanInfoForm.estateList = this.estateData
          var params = this.loanInfoForm
          this.$ajax.post(this.baseUrl + 'approve/process/task_process/service/saveLoanInfo', params).then(re => {
            var data = re.data
            var code = data.code
            var message = data.message
            if (code !== 'success') {
              this.$Message.warning(message)
              return
            }
            // 重新加载房产信息
            vm.loanInfoForm.estateList = data.data.estateList
            vm.loadEstateData()
            this.$Message.success(message)
          }).catch(er => {

          })
        }
      })
    },
    // 房产信息列表 动态添加一行
    addEstateDefaultEmptyRow () {
      this.estateData = this.cloneObject(this.tempEstateData)
      this.estateData.push(this.cloneObject(this.estateEmptyRowData))
    },
    // 初始化临时房产数组数据对象
    initTempEstateDataObject (params) {
      if (!this.tempEstateData[params.index]) {
        this.tempEstateData[params.index] = {}
      }
    },
    // 复制对象
    cloneObject (obj) {
      return JSON.parse(JSON.stringify(obj))
    }
    // 删除房产信息
    // delEstateRowData(params){
    //     var vm = this;
    //     var config = {
    //         title: "提示",
    //         content: '是否确认删除?',
    //         onOk: function(){
    //             var formData = params.row;
    //             if(!formData.id){//新增但是还未保存的房产记录
    //                 vm.tempEstateData.splice(params.index,1);
    //                 vm.estateData = vm.cloneObject(vm.tempEstateData);
    //                 return;
    //             }
    //             vm.$ajax.post(vm.baseUrl + 'approve/process/task_process/service/deleteEstateInfo', formData).then(re => {
    //                 var data = re.data;
    //                 var code = data.code;
    //                 var message = data.message;
    //                 if (code !== 'success') {
    //                     vm.$Message.warning(message);
    //                     return;
    //                 }
    //                 vm.tempEstateData.splice(params.index,1);
    //                 vm.estateData = vm.cloneObject(vm.tempEstateData);
    //             }).catch(er => {

    //             });
    //         }
    //     };
    //     this.$Modal.confirm(config);
    // }
  },
  computed: {

  },
  mounted () {
    // if(this.estateData && this.estateData.length < 1){
    //     this.addEstateDefaultEmptyRow();
    // }
  },
  created () {
    this.$ajax = this.$util.ajax()
    // this.initpage();
  },
  watch: {
    // 点击tab页签，加载数据，只加载一次
    'taskParams.loanInfo' (v) {
      if (v) {
        this.initpage()
      }
    }
  },
  props: {
    taskParams: Object
  }
}
</script>
